// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import Vuex from "vuex";
import App from './App';
import router from './router';
import axios from "axios";
import Vant from 'vant';
import 'vant/lib/index.css';

Vue.config.productionTip = false
Vue.use(Vuex);
Vue.use(Vant);

// 全局属性存储
const store = new Vuex.Store({
  state: {
    
  },
  mutations: {
    
  }
});
// 配置axios
Vue.prototype.$http = axios;
// 修改AJAX默认地址
// axios.defaults.baseURL = "http://218.202.240.118:8085";
axios.interceptors.request.use(
  function (response) {
    var token = "";//getCookie("token");
    if (token) {
      response.headers.token = token;
    }
    return response;
  },
  function (error) {
    console.log("网络错误，请刷新重试");
    return Promise.reject(error);
  }
);
axios.interceptors.response.use(
  res => {
    // if (res.data.code == "403") {
    //   // alert('登录信息已失效，请重新登录');
    // }
    // if (res.data.code != 200) {
      
    // }
    return res.data;
  },
  err => {
    console.log("网络错误，请刷新重试");
    return err;
  }
);

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
